package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    //查询是否存在该用户对象
    @Select("select * from tb_user where username = #{username} and password = #{password}")
    User select(@Param("username") String username, @Param("password") String password);

    //注册
    @Insert("insert into tb_user values(null,#{username},#{password},null,null)")
    void add(@Param("username") String username, @Param("password") String password);

    //查询是否有此用户
    @Select("select * from tb_user where username = #{username}")
    User selectByUsername(String username);
}
